#ifndef _Model3D
#define _Model3D


#include "Angel.h"
#include "BoundingBox.h"
#include "bmpread.h"
//typedef Angel::vec4  color4;
//typedef Angel::vec4  point4;

using namespace std;

class Model3D
{
public:
	//Model3D(){}
	Model3D();
	void readFile(string sfileName);
	void drawModel(mat4 transform, vec4 color = vec4( 0.0, 1.0, 0.0, 1.0));
	void init(string sfileName,string element = "regular");
	void addTexture();
	void swapTexture();
	
	
private:
	void reset();//nothing now
	void generateCube();
	void generatePlane();
	void createVBO();
	void initShader();
	void triangle(int a, int b, int c);
	void quad( int a, int b, int c, int d );
	void matrixToArray();
	void sphereUniform();
	void cylinderUniform();
	void setupProjection();
	void loadTexture(string sfileName1, string sfileName2);
	

	static const int NumPoints = 40000; 
	static const int NumVertices = 6000;
	static const int POINT_SIZE = 16;//temp 
	GLint numOfVertices;
	GLint numOfPolygons;
	GLint Index;
	GLuint programId;
	//geometry
	vector<point4> points;
	vector<point4> colors;
	vector<point4> vertices;
	BoundingBox boundingBox;
	string elementType;

	//vbo
	GLuint vao;
	GLuint bufferId;

	//texture
	bmpread_t bitmap;
	GLuint  textureId ;//= 0;//why static?
	GLuint textures[2];
	bool texToggle;
	bool isTextured;
	vector<point2> texCoords;
	
	//display
	mat4 _ctm;

};

#endif